.TH "CEC-CTL" "1" "August 2016" "v4l-utils @PACKAGE_VERSION@" "User Commands"
.SH NAME
cec-ctl - An application to control cec devices
.SH SYNOPSIS
.B cec-ctl
[\fI\-h\fR] [\fI\-d <dev>\fR] [many other options]
.SH DESCRIPTION
The cec-ctl tool is used to control cec devices. It is able to control almost
any aspect of such devices covering the full CEC API.

The easiest way to quickly test a CEC adapter of an HDMI output is:

	cec-ctl -d/dev/cecX --playback -S

This is what you would use if the HDMI output of your device supports
CEC: your device will play back video, so it is a CEC Playback device.

And for an HDMI input:

	cec-ctl -d/dev/cecX --tv -S

This is what you would use if your device has an HDMI input, i.e. it
acts like a TV.

Both commands configure the CEC adapter and show the CEC topology.
The '--playback' and '--tv' options configure \fIyour\fR device, they are
not about what device you will be talking to.

To put a display to standby use:

	cec-ctl -d/dev/cecX --to 0 --standby

To wake up the display:

	cec-ctl -d/dev/cecX --to 0 --image-view-on

To switch the TV to our HDMI output (replace the physical address with
what cec-ctl -d/dev/cecX reported):

	cec-ctl -d/dev/cecX --to 0 --active-source phys-addr=1.0.0.0

Instead of '-d/dev/cecX' you can also write this as '-dX'.
And instead of '--to 0' you can also write this as '-t0'.

.SH OPTIONS
.TP
\fB\-d\fR, \fB\-\-device\fR \fI<dev>\fR
Use device <dev> as the CEC device. If <dev> is a number, then /dev/cec<dev> is used.
.TP
\fB\-D\fR, \fB\-\-driver\fR \fI<drv>\fR
Use a cec device that has driver name \fI<drv>\fR, as returned by the CEC_ADAP_G_CAPS ioctl.
This option can be combined with \fB\-a\fR to uniquely identify a CEC device without
having to rely on the device node number.
.TP
\fB\-a\fR, \fB\-\-adapter\fR \fI<adap-name>\fR
Use a cec device that has adapter name \fI<adap-name>\fR, as returned by the CEC_ADAP_G_CAPS ioctl.
This option can be combined with \fB\-D\fR to uniquely identify a CEC device without
having to rely on the device node number.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Turn on verbose reporting.
.TP
\fB\-\-version\fR
Show version information.
.TP
\fB\-w\fR, \fB\-\-wall\-clock\fR
Show timestamps as wall-clock time. This also turns on verbose reporting.
.TP
\fB\-h\fR, \fB\-\-help\fR
Prints the help message.
.TP
\fB\-p\fR, \fB\-\-phys\-addr\fR \fI<addr>\fR
Use this physical address. The address can be a number (e.g. 0 or 0x11b1)
or formatted as a.b.c.d where each component is a hex value from 0-f
(e.g. 0.0.0.0 or 1.1.b.1).
.TP
\fB\-e\fR, \fB\-\-phys\-addr\-from\-edid\fR \fI<path>\fR
Parse the given EDID file (in raw binary format) and extract the physical
address. If the EDID file does not exist or does not contain a physical
address, then invalidate the physical address.
.TP
\fB\-E\fR, \fB\-\-phys\-addr\-from\-edid\-poll\fR \fI<path>\fR
Parse the given EDID file (in raw binary format) and extract the physical
address. If the EDID file does not exist or does not contain a physical
address, then invalidate the physical address. Poll for changes in this
EDID file every 100 ms and, if changed, update the physical address.

This provides a way for Pulse-Eight (or similar) USB CEC dongles to become
aware of HDMI disconnect and reconnect events.

Polling happens in the background while cec-ctl processes other requested
actions (i.e. transmitting messages, waiting for replies, etc.) and when that
is all done cec-ctl will keep polling until the user kills cec-ctl (Ctrl-C).
.TP
\fB\-o\fR, \fB\-\-osd\-name\fR \fI<name>\fR
Use this OSD name. The maximum length is 14 characters.
.TP
\fB\-V\fR, \fB\-\-vendor\-id\fR \fI<id>\fR
Use this vendor ID. The vendor ID is a number from 0x0 to 0xffffff.
.TP
\fB\-l\fR, \fB\-\-logical\-address\fR
Show first configured logical address or nothing if the device is unconfigured.
Useful for scripts, e.g.: la=`cec-ctl -s -l`
.TP
\fB\-L\fR, \fB\-\-logical\-addresses\fR
Show all configured logical addresses or nothing if the device is unconfigured.
Useful for scripts, e.g.: las=`cec-ctl -s -L`
.TP
\fB\-C\fR, \fB\-\-clear\fR
Clear all logical addresses, leaving the CEC device unconfigured.
.TP
\fB\-n\fR, \fB\-\-no\-reply\fR
By default when sending a CEC message that expects a reply this utility will
wait for that reply. With this option it will just send it without waiting
for the reply. This option applies to the messages following this option.
It acts as a toggle, so after you specify it a second time then the following
messages will wait for a reply again.
.TP
\fB\-N\fR, \fB\-\-non\-blocking\fR
Transmit messages in non-blocking mode.
.TP
\fB\-t\fR, \fB\-\-to\fR \fI<la>\fR
Send the message to the given logical address (0-15).
.TP
\fB\-f\fR, \fB\-\-from\fR \fI<la>\fR
Send message from the given logical address. It is only necessary to use this
option if multiple logical addresses are claimed. By default the first assigned
logical address will be used.
.TP
\fB\-r\fR, \fB\-\-show\-raw\fR
Show the raw CEC message in hex.
.TP
\fB\-s\fR, \fB\-\-skip\-info\fR
Skip the Driver Info output section.
.TP
\fB\-S\fR, \fB\-\-show\-topology\fR
Show the CEC topology, detecting which other CEC devices are on the CEC bus.
.TP
\fB\-P\fR, \fB\-\-poll\fR
Send a poll message.
.TP
\fB\-T\fR, \fB\-\-trace\fR
Trace all called ioctls. Useful for debugging.
.TP
\fB\-\-cec\-version\-1.4\fR
Use CEC Version 1.4 instead of 2.0 (the default).
.TP
\fB\-\-allow\-unreg\-fallback\fR
Allow fallback to Unregistered if all logical addresses are claimed.
By default the adapter will remain unconfigured.
.TP
\fB\-\-no\-rc\-passthrough\fR
Disable the RC passthrough. By default remote control CEC messages are
passed on as input keystrokes (the \fBCEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU\fR
flag is set when calling the \fBCEC_ADAP_S_LOG_ADDRS\fR ioctl), but this
can be blocked by using this option.
.TP
\fB\-\-reply\-to\-followers\fR
The reply will be sent to followers as well. By default the reply will only
go to the follower that initiated the CEC message. But if you have other
followers running as well, then by giving this option they will also receive
the reply.
.TP
\fB\-\-timeout\fR \fI<ms>\fR
Set the reply timeout in milliseconds (default is 1000 ms).
.TP
\fB\-\-tv\fR
Configure the CEC adapter as a TV.
.TP
\fB\-\-record\fR
Configure the CEC adapter as a recording and playback device.
.TP
\fB\-\-tuner\fR
Configure the CEC adapter as a tuner device.
.TP
\fB\-\-playback\fR
Configure the CEC adapter as a playback device.
.TP
\fB\-\-audio\fR
Configure the CEC adapter as an audio system device.
.TP
\fB\-\-processor\fR
Configure the CEC adapter as a processor device.
.TP
\fB\-\-switch\fR
Configure the CEC adapter as a pure CEC switch.
.TP
\fB\-\-cdc\-only\fR
Configure the CEC adapter as a CDC-only device.
.TP
\fB\-\-unregistered\fR
Configure the CEC adapter as an unregistered device.
.TP
\fB\-\-feat\-record\-tv\-screen\fR
Signal the Record TV Screen feature.
.TP
\fB\-\-feat\-set\-osd\-string\fR
Signal the Set OSD String feature.
.TP
\fB\-\-feat\-deck\-control\fR
Signal the Deck Control feature.
.TP
\fB\-\-feat\-set\-audio\-rate\fR
Signal the Set Audio Rate feature.
.TP
\fB\-\-feat\-sink\-has\-arc\-tx\fR
Signal the sink ARC Tx feature.
.TP
\fB\-\-feat\-source\-has\-arc\-rx\fR
Signal the source ARC Rx feature.
.TP
\fB\-\-rc\-tv\-profile\-1\fR
Signal RC TV Profile 1.
.TP
\fB\-\-rc\-tv\-profile\-2\fR
Signal RC TV Profile 2.
.TP
\fB\-\-rc\-tv\-profile\-3\fR
Signal RC TV Profile 3.
.TP
\fB\-\-rc\-tv\-profile\-4\fR
Signal RC TV Profile 4.
.TP
\fB\-\-rc\-src\-dev\-root\fR
Signal that the RC source has a Dev Root Menu.
.TP
\fB\-\-rc\-src\-dev\-setup\fR
Signal that the RC source has a Dev Setup Menu.
.TP
\fB\-\-rc\-src\-contents\fR
Signal that the RC source has a Contents Menu.
.TP
\fB\-\-rc\-src\-media\-top\fR
Signal that the RC source has a Media Top Menu.
.TP
\fB\-\-rc\-src\-media\-context\fR
Signal that the RC source has a Media Context Menu.
.TP
\fB\-m\fR, \fB\-\-monitor\fR
Start monitoring CEC traffic. This will monitor broadcast messages,
messages directed to this CEC adapter and messages transmitted by this
CEC adapter. Directed messages between other CEC devices are not
monitored. This option requires root.
.TP
\fB\-M\fR, \fB\-\-monitor\-all\fR
Start monitoring all CEC traffic. This will monitor all CEC messages,
including directed messages between other CEC devices. This option requires root.
Not all CEC devices support this monitoring mode. It will fallback to regular
monitoring mode if it is not supported.
.TP
\fB\-\-monitor\-pin\fR
Start monitoring and analyzing the low-level CEC pin transitions. This is only
possible if the device has the CEC_CAP_MONITOR_PIN capability. This option requires root.
When in pin monitoring mode all 0->1 and 1->0 CEC pin transitions are monitored and
analysed. This is effectively a cheap CEC bus analyzer.
.TP
\fB\-\-monitor\-time\fR \fI<secs>\fR
Monitor for the given number of seconds, then exit. The default (0) is to monitor
forever.
.TP
\fB\-\-ignore\fR \fI<la>\fR,\fI<opcode>\fR
Ignore messages from logical address <la> and opcode <opcode> when monitoring.
"all" can be used for <la> or <opcode> to match all logical addresses or opcodes.
To ignore poll messages use "poll" as <opcode>.
.TP
\fB\-\-store\-pin\fR \fI<to>\fR
Store the CEC pin events to the given file. This can be read and analyzed later
via the \fB\-\-analyze\-pin\fR option. Use \- to write to stdout instead of to a file.
.TP
\fB\-\-analyze\-pin\fR \fI<from>\fR
Read and analyze the CEC pin events from the given file. Use \- to read from stdin
instead of from a file.
.TP
\fB\-\-test\-standby\-wakeup\-cycle\fR [\fIpolls\fR=\fI<n>\fR][,\fIsleep\fR=\fI<secs>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0/1>\fR]
This option tests the standby-wakeup cycle behavior of the display. It polls up to
\fI<n>\fR times (default 15), waiting for a state change. If that fails then it
waits \fI<secs>\fR seconds (default 10) before retrying this.
If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in standby.
.TP
\fB\-\-stress\-test\-standby\-wakeup\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fIpolls\fR=\fI<n>\fR][,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0/1>\fR]
This option performs a stress test for a display: it cycles the display \fI<count>\fR
times in and out of standby using the CEC Standby and Image View On commands.
If \fI<count>\fR is 0, then never stop.
It polls up to \fI<n>\fR times (default 30), waiting for a state change.
If \fI<maxsecs>\fR is non-zero (0 is the default), then sleep for a random number of seconds
between \fI<minsecs>\fR (0 is the default) and \fI<maxsecs>\fR before each <Standby> or
<Image View On> message.
If \fI<seed>\fR is specified, then set the randomizer seed to that value instead of
using the current time as seed.
If \fI<reps>\fR is specified, then repeat the <Image View On> and <Standby> up to
\fI<reps>\fR times. Note that this test should work without any repeats. If a
non-zero \fI<reps>\fR value is needed in order to pass this test, then that indicates
a problem.
If \fI<secs1>\fR is specified, then sleep for <secs1> seconds before transmitting <Image View On>.
If \fI<secs2>\fR is specified, then sleep for <secs2> seconds before transmitting <Standby>.
If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in standby.
.TP
\fB\-\-stress\-test\-random\-standby\-wakeup\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0/1>\fR]
This option performs a stress test for a display: it cycles the display \fI<count>\fR
times in and out of standby using the CEC Standby and Image View On commands.
After each command wait between \fI<minsecs>\fR (default is 0) and \fI<maxsecs>\fR (default is 10)
seconds.
This test does not check if the display reached the new state,
this test is meant to check if the display can handle state change commands
while still transitioning to a new state.  After every 10 cycles it attempts to properly
wake up the display and check if that works. If not, this test fails.
If \fI<count>\fR is 0, then never stop.
If \fI<seed>\fR is specified, then set the randomizer seed to that value instead of
using the current time as seed.
If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in standby.
.TP
\fB\-\-help\-all\fR
Prints the help message for all options.
.TP
\fB\-\-help\-audio\-rate\-control\fR
Show help for the Audio Rate Control feature.
.TP
\fB\-\-help\-audio\-return\-channel\-control\fR
Show help for the Audio Return Channel Control feature.
.TP
\fB\-\-help\-capability\-discovery\-and\-control\fR
Show help for the Capability Discovery and Control feature.
.TP
\fB\-\-help\-deck\-control\fR
Show help for the Deck Control feature.
.TP
\fB\-\-help\-device\-menu\-control\fR
Show help for the Device Menu Control feature.
.TP
\fB\-\-help\-device\-osd\-transfer\fR
Show help for the Device OSD Transfer feature.
.TP
\fB\-\-help\-dynamic\-audio\-lipsync\fR
Show help for the Dynamic Audio Lipsync feature.
.TP
\fB\-\-help\-htng\fR
Show help for the Hospitality Profile Next Generation feature.
This is an optional CEC extension for Hotel displays and is not
generally available for regular displays. See http://www.htng.org
for more information.
.TP
\fB\-\-help\-osd\-display\fR
Show help for the OSD Display feature.
.TP
\fB\-\-help\-one\-touch\-play\fR
Show help for the One Touch Play feature.
.TP
\fB\-\-help\-one\-touch\-record\fR
Show help for the One Touch Record feature.
.TP
\fB\-\-help\-power\-status\fR
Show help for the Power Status feature.
.TP
\fB\-\-help\-remote\-control\-passthrough\fR
Show help for the Remote Control Passthrough feature.
.TP
\fB\-\-help\-routing\-control\fR
Show help for the Routing Control feature.
.TP
\fB\-\-help\-standby\fR
Show help for the Standby feature.
.TP
\fB\-\-help\-system\-audio\-control\fR
Show help for the System Audio Control feature.
.TP
\fB\-\-help\-system\-information\fR
Show help for the System Information feature.
.TP
\fB\-\-help\-timer\-programming\fR
Show help for the Timer Programming feature.
.TP
\fB\-\-help\-tuner\-control\fR
Show help for the Tuner Control feature.
.TP
\fB\-\-help\-vendor\-specific\-commands\fR
Show help for the Vendor Specific Commands feature.
.SH EXIT STATUS
On success, it returns 0. Otherwise, it will return the error code.
.SH BUGS
This manual page is a work in progress.

Bug reports or questions about this utility should be sent to the linux-media@vger.kernel.org
mailinglist.
